package Huihu.src.Duoxiancheng;
//销售员一人买10张票
public class TestThreades extends Thread{
    private int ticktle=10;
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            if (ticktle>0){
                System.out.println(Thread.currentThread().getName()+"正在卖第"+ticktle+"张票");
                ticktle--;
            }else {
                break;
            }
        }
    }

    public static void main(String[] args) {
        TestThreades testThreades1=new TestThreades();
        TestThreades testThreades2=new TestThreades();
        TestThreades testThreades3=new TestThreades();
        testThreades1.setName("销售员一");
        testThreades2.setName("销售员二");
        testThreades3.setName("销售员三");
        testThreades1.start();
        testThreades2.start();
        testThreades3.start();
    }

}
